A good answer might be:

int counter=0;

while ( counter < 10 )
{
  System.out.println("counter is now " + counter );
  counter++ ;
}

Increment Operator

The increment operator ++ adds one to a variable. Usually the variable is an integer type (byte, short, int, or long) but it can be a floating point type (float or double.) No character is allowed between the two plus signs. Usually the plus signs are put immediately adjacent to the variable, as above, although this is not necessary.

The increment operator can be used as part of an arithmetic expression, as in the following:

int sum = 0;
int counter = 10;

sum = counter++ ;

System.out.println("sum: "+ sum " + counter: " + counter );

Here is how the statement sum = counter++; works: In the statement sum = counter++; the variable counter is incremented after the value it holds has been used. It is vital to understand the details of this:

QUESTION 3:

Inspect the following code:

int x = 99;
int y = 10;

y = x++ ;

System.out.println("x: " + x + "  y: " + y );

What does the above program print?